<?php
class BlogpostsController extends AppController {

	var $name = 'Blogposts';
	var $uses = array('Blogpost','Comment','User');
	

	function index() {
		$this->set('blogposts', $this->Blogpost->find('all'));
		$this->set('user', $this->Session->read('Auth.User'));
	}
	
	function add() {
		$this->set('user', $this->Session->read('Auth.User'));
		
		if (!empty($this->data)) {
			if ($this->Blogpost->save($this->data)) {
				$this->Session->setFlash('Post added.');
				$this->redirect(array('action' => 'index'));
			}
		}
	}
	
	function view($id=null) {
		
	}
}
?>